<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class SwiperResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        $imageOptions = [
            'crop' => 'limit',
            'quality' => 'auto',
        ];
        return [
            'id' => $this->id,
            'description' => $this->description,
            'image' => attachmentUrl($this->image, 600, null, $imageOptions),
            'jump_type' => $this->jump_type,
            'jump_value' => $this->jump_value,
        ];
    }
}
